<template>
  <!-- 课程详情页 -->
  <div class="qy-page-course-detail pbm" id="page-course-detail">
    <uni-nav-bar fixed shadow :border="false" :title="'【直播】' + (info && info.name || '')" left-icon="left" @clickLeft="goBefore"></uni-nav-bar>
    <view>
      <div class="page-banner">
        <div
          class="banner-default-img flex-wrap flex-middle flex-center"
          :style="{
            background: 'url(' + info.imageHttpUrl + ') center no-repeat'
          }"
          v-if="info.imageHttpUrl"
        >
          <div class="item-status"><i class="icon-data" v-if="info.liveStatus === '1'"></i>{{ statusList[info.liveStatus] }}</div>
          <div class="banner-default-text ellipsis2" v-if="showTitle === '1'">
            {{ info.name }}
          </div>
        </div>
        <div
          class="banner-default-img flex-wrap flex-middle flex-center"
          :class="['live-' + info.liveStatus]"
          v-else
        >
          <div class="item-status"><i class="icon-data" v-if="info.liveStatus === '1'"></i>{{ statusList[info.liveStatus] }}</div>
          <div class="banner-default-text ellipsis2">{{ info.name }}</div>
        </div>
<!--        <van-icon name="arrow-left" class="page-navi-icon" @click="goBefore" />-->
      </div>
      <div class="page-info-wrap">
        <div class="info-base">
          <div class="info-content ">
            <div class="left">{{ info.name }} </div>
          </div>
          <div class="bottom flex-wrap">
            <i class="icon-clock"></i>
            <span class="common-font">{{ info.realStartDate || info.startDate }}</span>
          </div>
          <div class="bottom flex-wrap">
            <i class="icon-category"></i>
            <span class="common-font">{{ info.categoryName }}</span>
          </div>
          <div class="bottom flex-wrap">
            <i class="icon-user"></i>
            <span class="common-font">{{ info.authorUserName || '无' }} | {{ info.studyStuNum || 0 }}人已加入</span>
          </div>
          <div class="bottom flex-wrap" v-if="info.credit || info.pointScore">
            <i class="icon-pointScore"></i>
            <template v-if="isOpenCredit === '1'">
              <span class="common-font" v-if="info.credit">{{ info.credit }}学分</span>
              <span class="common-font" v-if="info.credit && info.pointScore"> | </span>
            </template>
            <span class="common-font" v-if="info.pointScore && isOpenPointScore === '1'">{{ info.pointScore }}积分</span>
          </div>
          <div class="bottom flex-wrap flex-text-mid" v-if="editionType === '2'">
            <i class="icon-laiyuan"></i>
            <span class="common-font ellipsis">{{ info.siteName }}</span>
          </div>
        </div>
      </div>
    </view>
    <!-- TABS -->
    <div class="page-tab-wrap">
      <div class="page-tab-group"></div>
      <van-tabs v-model="activeTab">
        <van-tab title="详情">
          <div  class="w-e-text course-base">直播已结束</div>
        </van-tab>
        <van-tab title="资料" >
          <div class="w-e-text course-base">暂无相关资料</div>
        </van-tab>
      </van-tabs>
    </div>

    <div  class="page-ctrl-bar flex-wrap flex-middle">
        <button type="primary"  v-if="info.liveStatus === '2'" @click="goDetail">回放</button>
    </div>
  </div>
</template>

<script>
import { mapGetters, mapActions, mapState } from "vuex";
import CourseData from "@/components/course/CourseData.vue";
import vanTabs from "@/components/vant/van-tabs/van-tabs.vue"
import vanTab from "@/components/vant/van-tab/van-tab.vue"
import mockData from "@/mock/live/detail.json"
export default {
  head() {
    return {
      title: "直播详情"
    };
  },
  components: {
    CourseData,
	vanTabs,
	vanTab
  },
  data() {
    return {
      showPopover: false,
      info: {}, // 课程基础信息
      activeTab: 0, // 选中的TAB index
      courseBtnLoading: false,
      id: "", // ID
      courseContent: "",
      type: "L",
      cerDrawStatus: "",
      stageList: [],
      roomLiveList: [],
      statusList: ['即将开始', '进入直播', '已结束'],
    };
  },
  onLoad(query) {
  	this.id = query.id || ''
  },
  mounted() {
    this.initPage();
  },
  watch: {},
  methods: {

    initPage() {
      this.getInfo();
    },

    goBefore() {
      uni.navigateBack({ delta: 1 });
    },
    goDetail() {
      this.$uniPush({
        name: "live-living-id",
        params: {
          id: this.id
        }
      })
    },
    // 选课
    handleSubmit(item) {
      //
    },

    // 获取课程详情
    getInfo() {
		this.info=mockData.data;
    }
  }
};
</script>

<style lang="scss" scoped>
@import "@/static/css/variable.scss";
:deep(uni-button){
	width: 100% !important;
}
.qy-page-course-detail {
  &.pbm {
    padding-bottom: 74px;
  }
  .page-banner {
    position: relative;
    font-size: 0;
    .quit-btn {
      position: absolute;
      right: 10px;
      top: 6px;
      font-size: 22px;
      color: #fff;
    }
    .banner-default-img {
      width: 100%;
      height: 210px;
      background: url('/static/image/course-img.png') no-repeat;
      background-size: contain !important;
      .banner-default-text {
        font-size: 22px;
        color: #fff;
        text-align: center;
        padding: 0 20px;
      }
      .item-status{
        position: absolute;
        top: 10px;
        right: 15px;
        width: 82px;
        height: 32px;
        border-radius: 16px;
        line-height: 32px;
        font-size: 12px;
        color: #fff;
        text-align: center;
        background: rgba(0, 0, 0, 0.5);
        z-index: 10;
      }
    }
  }
  .page-info-wrap {
    position: relative;
    z-index: 1;
    background: #f6f6f6;
    padding: 10px;
    .info-base {
      background: #ffffff;
      border-radius: 6px;
      padding: 15px 13px;
      .info-content {
        .left {
          width: 100%;
          font-size: 18px;
          font-weight: bold;
          margin: 5px 0 15px;
        }
      }
      .top {
        display: flex;
        justify-content: space-between;
        line-height: 0;
        align-items: baseline;
        .top-left {
          .default-tag {
            margin-right: 5px;
          }
        }
        .top-right {
          .font-split {
            margin: 0 5px 0 8px;
            vertical-align: -2px;
          }
          .info-loc {
            max-width: 200px;
            display: inline-block;
            vertical-align: -2px;
          }
        }
      }
      .bottom {
        margin-top: 5px;
        .icon-clock {
            margin-top: 2px;
            margin-right: 5px;
        }
        .icon-category {
            margin-top: 2px;
            margin-right: 5px;
        }
        .icon-user, .icon-addr, .icon-credit , .icon-pointScore, .icon-certificate {
          margin-right: 5px;
          margin-top: 2px;
        }
        .common-font {
          display: inline-block;
          vertical-align: middle;
        }
      }
    }
    .info-teac {
      margin-top: 10px;
      :deep(.van-swipe){
        .van-swipe__indicator {
          background-color: #999;
          opacity: 1;
        }
        .van-swipe__indicator--active {
          background-color: $primaryColor;
        }
      }
      .teac-wrap {
        background: #fff;
        border-radius: 6px;
        padding: 15px 15px 25px;
        display: flex;
        min-height: 120px;
        img {
          margin-right: 8px;
        }
        .wrap-content {
          width: 85%;
          .name {
            line-height: 0;
          }
          .name-title {
            font-size: 16px;
            font-weight: bold;
            line-height: 22px;
          }
        }
      }
    }
  }
  .page-tab-wrap {
    position: relative;
    .page-tab-group {
      display: none;
      position: absolute;
      right: 0px;
      background-image: url("../../../static/image/tab_group.png");
      width: 18px;
      height: 15px;
      background-size: 100%;
      top: 12px;
      z-index: 999;
      background-color: #fff;
    }
    :deep(.van-tabs__nav){
      .van-tab {
        max-width: 25%;
      }
    }
    &.fixed {
      .page-tab-group {
        position: fixed;
      }
    :deep(.van-tabs__wrap){
        position: fixed;
        top: 0;
        z-index: 2;
        width: 100%;
      }
      :deep(.van-tabs__content){
        padding-top: 44px;
      }
    }
    :deep(.course-base){
      font-size: 14px;
      padding: 15px;
      img {
        max-width: 100%;
      }
      h1,
      h2,
      h3,
      h4,
      h5 {
        height: auto !important;
      }
    }
    .detail-wrap {
      padding: 15px;
      border-top: 10px solid #f6f6f6;
    }
  }
  .page-ctrl-bar {
    display: flex;
    justify-content: space-between;
    position: fixed;
    align-items: center;
    width: 100%;
    background: #fff;
    bottom: 0;
    padding: 15px;
    box-shadow: 0px 1px 0px 0px #eeeeee;
    z-index: 1;
    .left-ctrl {
      width: 85px;
    }
    .price-text {
      white-space: nowrap;
    }
    .buy-info-btn {
      width: 100%;
    }
    .van-icon{
      color: $primaryColor;
      font-size: 20px;
      margin-right: 3px;
    }
    button {
      //flex: 1;
      height: 40px;
      border-radius: 20px;
      border: 0;
      &:disabled {
        color: #7f7f7f;
        background: #dddddd;
        cursor: not-allowed;
      }
      &.van-button--primary{
        flex: 1;
      }
      & + button {
        margin-left: 15px;
      }
    }
  }
 :deep(.qy-com-appraise-list .bottom-input-bar){
    z-index: 111;
  }
 :deep(.qy-com-discuss-list .bottom-input-bar){
    z-index: 111;
  }
  .cer-draw-wrap {
    position: absolute;
    left: 15px;
    bottom: 70px;
    width: calc(100% - 30px);
    height: 50px;
    background: #ffffff;
    box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    border: 1px solid #eeeeee;
    padding: 0 15px;
    button {
      width: 72px;
      height: 28px;
      padding: 0 2px;
      border: none;
      background: linear-gradient(148deg, #fbd249 0%, #f5a623 100%);
    }
  }
  .list-item {
    width: 120px;
    padding: 16px;
    img {
      width: 16px;
      margin-right: 8px;
    }
  }
  .audit-wrap {
    .status {
      padding: 16px 20px;
      i {
        font-size: 18px;
        margin-right: 4px;
        color: #666;
        &.van-icon-passed {
          color: #7ed321;
        }
        &.van-icon-close {
          color: #e10c0c;
        }
      }
    }
    .remark {
      width: calc(100% - 40px);
      margin: 0 auto;
      padding: 10px;
      font-size: 12px;
      font-weight: 400;
      color: #7f7f7f;
      line-height: 19px;
      background: #fafafa;
    }
  }
}
</style>
